package Game;

public class NodePosition {
    float[] float_pos = new float[3];
    float[] float_dir = new float[3];

    public NodePosition(float x, float y, float z, float dir_X, float dir_Y, float dir_Z) {
        this.float_pos = new float[]{x, y, z};
        this.float_dir = new float[]{dir_X, dir_Y, dir_Z};
    }

    public NodePosition(float[] position, float[] direction){
        this.float_pos = position;
        this.float_dir = direction;
    }

    public NodePosition(String ID_line) {
        String[] split_pos = ID_line.split(Packet.SEPARATOR[2])[0].substring(1).split(Packet.SEPARATOR[3]);
        String[] split_dir = ID_line.split(Packet.SEPARATOR[2])[1].substring(0, ID_line.split(Packet.SEPARATOR[2])[1].length()-1).split(Packet.SEPARATOR[3]);
        for (int i = 0; i < 3; i++){
            float_pos[i] = Float.parseFloat(split_pos[i]);
            float_dir[i] = Float.parseFloat(split_dir[i]);
        }
    }
    
    @Override
    public String toString() {
        return "<" + float_pos[0] + Packet.SEPARATOR[3] + float_pos[1] + Packet.SEPARATOR[3] + float_pos[2] + Packet.SEPARATOR[2] + float_dir[0] + Packet.SEPARATOR[3] + float_dir[1] + Packet.SEPARATOR[3] + float_dir[2] + ">";
    }
}